//导入自己编写封装的http.js文件
import http from "./http";

export function getAd(id, num, hot) {
    return http.requestPost('/wap/ad/getAd', {
        category_id: id,
        limit: num,
        is_recommend: hot
    });
}

export function getIndex(type, page) {
    return http.requestPost('/wap/index/index', {
        type: type,
        page: page
    });
}

export function getConfig(token) {
    return http.requestPost('/home/getConfig', {
        token: token,
    });
}

export function getCard(enterprise_id, token) {
    return http.requestPost('/wap/enterprise/index', {
        token: token,
        enterprise_id: enterprise_id
    });
}

export function getArticle(url, enterprise_id) {
    return http.requestPost(url, {
        enterprise_id: enterprise_id,
        page: 1,
        limit: 10
    });
}


export function getBrowsing(enterprise_id) {
    return http.requestPost('/wap/info/agent', {
        enterprise_id: enterprise_id,
        page: 1,
        limit: 4
    });
}

export function getCustomer() {
    return http.requestPost('/wap/config/customer', {});
}

export function getShop(enterprise_id) {
    return http.requestPost('/wap/index/good/recommend', {
        page: 1,
        limit: 6,
        enterprise_id: enterprise_id
    });
}


export function getMenu(enterprise_id) {
    return http.requestPost('/wap/enterpriseType/cate', {});
}

export function getMenuList(id) {
    return http.requestPost('/wap/enterpriseType/list', {
        one_cate_id: id
    });
}

// 新闻页 query传递的是article_id
export function getNewDetail(id) {
    return http.requestPost('/wap/article/detail', {
        article_id: id
    });
}

export function getNewArticle(enterprise_id, article_id) {
    return http.requestPost('/wap/info/article', {
        enterprise_id: enterprise_id,
        article_id: article_id,
        page: 1,
        limit: 10
    });
}